-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor right panel header buttons #5117
Conversation
To reduce repetition of code, simplify the process of adding header buttons and remove the need for many handler functions.
(I'll squash merge this) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise lgtm
// If currentPhase is one of the specified phases, the button will be highlighted | ||
phases: PropTypes.arrayOf(PropTypes.string).isRequired, | ||
// The currentPhase of the RightPanel | ||
currentPhase: PropTypes.string.isRequired, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there likely to be any need for the button to know the actual phases it represents or what the current phase is? Could we just pass in whether it should be highlighted or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we just pass in whether it should be highlighted or not?
I was hoping to abstract this logic away such that, for example, we can't get two buttons highlighted at once. It's probably overkill but if every single header button is going to embody this logic, it seems inefficient to dupe it for each one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it needs to know for the dispatch so 🤷♂️
Use isHighlighted as a prop instead of computing based on phases and currentPhase
To reduce repetition of code, simplify the process of adding header buttons and remove the need for many handler functions.